package com.sx.micowell.framework.model

import com.example.mvvm.base.data.MutableLiveListData
import com.example.mvvm.base.vm.BaseViewModel
import com.example.mvvm.until.LogUtils
import com.example.mvvm.until.SPUtils
import com.example.mvvm.until.ToastUtils
import com.miloyu.modelnet.network.ApiResponse
import com.miloyu.modelnet.network.HttpClient
import com.miloyu.modelnet.network.tools.RxUtils

import com.miloyu.modelnet.response.LearnedCourseVO
import com.miloyu.modelnet.response.LearnedCourseWrap

import com.sx.micowell.framework.app.SPKey
import java.util.HashMap

/**
 * @Author: YY
 * @Time: 2021/8/17
 * @Describe TODO
 */
class LearnedCourseModel : BaseViewModel() {

    var courseListData: MutableLiveListData<LearnedCourseVO> = MutableLiveListData<LearnedCourseVO>()

    fun learnedCourse() {

        HttpClient.instance.apiService
            .learnedCourse()
            .compose(RxUtils.compose())
            .subscribe(object : ApiResponse<LearnedCourseWrap>() {

                override fun success(data: LearnedCourseWrap?, msg: String?) {
                    courseListData.value = data?.info
                }

                override fun onFail(e: Throwable?, errorMsg: String?) {
                    ToastUtils.showShort("$errorMsg")
                }

            })
    }


}